#ifndef CHARTWIDGET_H
#define CHARTWIDGET_H

#include <QWidget>
#include <QTimer>
#include <QRandomGenerator>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include "yschartview.h"
#include "yscheckbox.h"
#include"models/command.h"
class ChartWidget : public QWidget
{
    Q_OBJECT

public:
    explicit ChartWidget(QWidget *parent = nullptr);
    ~ChartWidget();
    void setupCharts(JointType jointType);
    void updateData();
    void onCheckBoxStateChanged(int state);
private:
    void setupUI();
    void setupConnections();
    void setupCheckBoxes(int count);
protected:
    void showEvent(QShowEvent *event);
private:
    QVBoxLayout *mainLayout;
    QWidget *checkBoxContainer;
    QHBoxLayout *chartsLayout;
    QWidget *chart1Widget;
    QWidget *chart2Widget;
    QWidget *chart3Widget;
    
    YSChartView *chart1;
    YSChartView *chart2;
    YSChartView *chart3;
    QVector<YSCheckBox*> checkBoxes;
    QHBoxLayout* checkBoxLayout;
    JointType curJointType=HEAD_JOINT;

    bool m_bFirst=true;
};

#endif // CHARTWIDGET_H
